package com.whitedust.top10;

import com.whitedust.structure.ListNode;

/**
 * @author A
 * @since 2025/11/1 14:25
 */

public class Top3 {

    public ListNode reverseList(ListNode head) {
        if(head==null)return null;
        ListNode pre = null;
        ListNode cur = head;
        ListNode next = null;
        while(cur!=null){
            next = cur.next;
            cur.next=pre;
            pre = cur;
            cur = next;
        }
        return pre;
    }
}
